package com.example.sellersale.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.util.List;

@TableName("sys_goods")
public class Goods {
    @TableId(type = IdType.ASSIGN_ID)
    private String id;
    @TableField("goodsName")
    private String goodsName;
    @TableField("goodsNum")
    private Integer goodsNum;
    @TableField("goodsType")
    private String goodsType;
    @TableField("inPrice")
    private Double inPrice;//入库价格
    @TableField("outPrice")
    private Double outPrice;//出库价格

    @TableField(exist = false)
    private GoodsType description;
    @TableField(exist = false)
    private String status;

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    /*@TableField(exist = false)
        private List<Goods> goods;//一个类型的衣服，有很多具体的父类*/
    public Goods(){

    }
    public Goods(Goods g){
        this.id = g.getId();
        //这里是专门给Order服务的
        this.goodsNum = 0;
        this.goodsName = g.getGoodsName();
        this.description = g.getDescription();
        this.goodsType = g.getGoodsType();
        this.inPrice = g.getInPrice();
        this.outPrice = 0.0;
    }
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public Integer getGoodsNum() {
        return goodsNum;
    }

    public void setGoodsNum(Integer goodsNum) {
        this.goodsNum = goodsNum;
    }

    public String getGoodsType() {
        return goodsType;
    }

    public void setGoodsType(String goodsType) {
        this.goodsType = goodsType;
    }

    public Double getInPrice() {
        return inPrice;
    }

    public void setInPrice(Double inPrice) {
        this.inPrice = inPrice;
    }

    public Double getOutPrice() {
        return outPrice;
    }

    public void setOutPrice(Double outPrice) {
        this.outPrice = outPrice;
    }

    public GoodsType getDescription() {
        return description;
    }

    public void setDescription(GoodsType description) {
        this.description = description;
    }

   public void addNum(Integer num){
        this.goodsNum+=num;
   }

    @Override
    public String toString() {
        return "Goods{" +
                "id='" + id + '\'' +
                ", goodsName='" + goodsName + '\'' +
                ", goodsNum=" + goodsNum +
                ", goodsType='" + goodsType + '\'' +
                ", inPrice=" + inPrice +
                ", outPrice='" + outPrice + '\'' +
                ", description=" + description +
                '}';
    }
}
